package com.hmy.contract.bo.response.contract;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists;
import com.hmy.ccp.common.response.BaseResponse;
import com.hmy.contract.dal.po.ContractPo;
import java.util.List;
import java.util.stream.Collectors;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author wenjian
 * @version 1.0
 * @description 描述
 * @date 2024/2/26 14:02
 */

@Data
@EqualsAndHashCode(callSuper = true)
public class ContractQueryListResponse extends BaseResponse {

    /**
     * 合同id
     */
    private Long contractId;

    /**
     * 订单id
     */
    private Long orderId;

    /**
     * 订单编号-业务编号
     */
    private String orderNo;

    /**
     * 合同名称
     */
    private String contractName;

    /**
     * 合同编号-业务编号
     */
    private String contractNo;

    /**
     * 工程名称
     */
    private String projectName;

    /**
     * 客户id
     */
    private Long customerId;
    /**
     * 客户名称
     */
    private String customerName;

    /**
     * 客户手机号
     */
    private String customerPhone;

    /**
     * 关联任务Id
     */
    private Long relationId;

    /**
     * 关联任务编号- 进场单/退场单
     */
    private String relationNo;

    public static List<ContractQueryListResponse> convertToRsp(List<ContractPo> contractPoList) {
        if (CollUtil.isEmpty(contractPoList)) {
            return Lists.newArrayList();
        }

        return contractPoList.stream().map(contractPo -> {
            return BeanUtil.copyProperties(contractPo, ContractQueryListResponse.class);
        }).collect(Collectors.toList());
    }

}
